import React from 'react';
import {
  View,
} from 'react-native';

import { connect } from 'react-redux';

import TicketItem from './ticketItem';
import TicketAdd from './ticketAdd';
import CLNavigatorHeader from '../../component/CLNavigatorHeader';
import backIcon from '../../image/back.png';

import { NavigationActions } from 'react-navigation'

class Ticket extends React.Component {

  static token = '';

  static navigationOptions = ({ navigation, screenProps }) => ({
      header:<CLNavigatorHeader navigation={navigation} title="优惠券"
      rightTitle={'新增'} 
      rightAction={() => navigation.dispatch(NavigationActions.navigate({
                    routeName: 'ticketAdd',
        
                    params: {token: token},
        
                    action: NavigationActions.navigate({routeName: 'ticketAdd'})
                }))}
      />,
  });

  constructor(props) {
    super(props);

    token = props.token;
  }

  render() {
    return (
      <View style={{ flex: 1, flexDirection: 'column', backgroundColor: 'white' }}>
        <TicketItem />
      </View>
    );
  }
}

const mapStateToProps = state => ({
  token: state.mainmodel.token,
});

const mapDispatchToProps = dispatch => ({

});

export default connect(
  mapStateToProps,
  mapDispatchToProps
)(Ticket);
